home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 1 / PC Actual CD 01.iso / share / dos / graficos / plydat14.arj / POLYTOPE.PI < prev    next >
Encoding:
Text File  |  1992-04-05  |  5.7 KB  |  205 lines

  1. //
  2. // Polyray data file by Alexander Enzmann
  3. // 4 February 1992
  4. //
  5. // A number of polytopes (including the 5 regular polyhedra):
  6. //   tetrahedron, cube, octahedron, dodecahedron, icosahedron,
  7. //   stella_octangula, compound_cubocta, compound_dodecicos,
  8. //   cuboctahedron, and icosidodecahedron.
  9. //
  10. // Each of the 5 platonic solids has been scaled so that it exactly
  11. // fits into a sphere of radius 1.
  12. //  
  13.  
  14. viewpoint {
  15.    from  <0,0,-12>
  16.    at    <0,0,0>
  17.    up    <0,1,0>
  18.    angle 45
  19.    resolution 256, 256
  20.    }
  21.  
  22. background midnight_blue
  23. light < 20,30,-20>
  24. light <-20,30,-20>
  25.  
  26. bounding_slab <1, 0, 0>
  27. bounding_slab <0, 1, 0>
  28. bounding_slab <0, 0, 1>
  29.  
  30. include "colors.inc"
  31.  
  32. define  tau 1.6180339887 // Golden mean = (1 + sqrt(5))/2
  33. define itau 0.6180339888 // tau^-1
  34.  
  35. // dist to vertex = 1.73073
  36. define tetrahedron
  37. object {
  38.      object { polynomial  x + y + z - 1 }
  39.    * object { polynomial  x - y - z - 1 }
  40.    * object { polynomial -x + y - z - 1 }
  41.    * object { polynomial -x - y + z - 1 }
  42.    bounds object { sphere <0, 0, 0>, 1.73073 }
  43.    scale <1/1.73073, 1/1.73073, 1/1.73073>
  44.    }
  45.  
  46. // dist to a vertex = 1.73205
  47. define cube
  48. object {
  49.      object { polynomial  x - 1 }
  50.    * object { polynomial  y - 1 }
  51.    * object { polynomial  z - 1 }
  52.    * object { polynomial -x - 1 }
  53.    * object { polynomial -y - 1 }
  54.    * object { polynomial -z - 1 }
  55.    bounds object { sphere <0, 0, 0>, 1.73205 }
  56.    scale <1/1.73205, 1/1.73205, 1/1.73205>
  57.    }
  58.  
  59. // dist to vertex = 1
  60. define octahedron
  61. object {
  62.      object { polynomial  x + y + z - 1 }
  63.    * object { polynomial  x + y - z - 1 }
  64.    * object { polynomial  x - y + z - 1 }
  65.    * object { polynomial  x - y - z - 1 }
  66.    * object { polynomial -x + y + z - 1 }
  67.    * object { polynomial -x + y - z - 1 }
  68.    * object { polynomial -x - y + z - 1 }
  69.    * object { polynomial -x - y - z - 1 }
  70.    bounds object { sphere <0, 0, 0>, 1 }
  71.    }
  72.  
  73. // dist to vertex = 0.66158
  74. define dodecahedron
  75. object {
  76.      object { polynomial  z + tau * y - 1 }
  77.    * object { polynomial  z - 1.6180339887 * y - 1 }
  78.    * object { polynomial -z + 1.6180339887 * y - 1 }
  79.    * object { polynomial -z - tau * y - 1 }
  80.    * object { polynomial  x + tau * z - 1 }
  81.    * object { polynomial  x - tau * z - 1 }
  82.    * object { polynomial -x + tau * z - 1 }
  83.    * object { polynomial -x - tau * z - 1 }
  84.    * object { polynomial  y + tau * x - 1 }
  85.    * object { polynomial  y - tau * x - 1 }
  86.    * object { polynomial -y + tau * x - 1 }
  87.    * object { polynomial -y - tau * x - 1 }
  88.    bounds object { sphere <0, 0, 0>, 0.66158 }
  89.    scale <1/0.66158, 1/0.66158, 1/0.66158>
  90.    }
  91.  
  92. // Icosahedron, dist from center to a vertex = 0.72654
  93. define icosahedron
  94. object {
  95.      object { polynomial  x + y + z - 1 }
  96.    * object { polynomial  x + y - z - 1 }
  97.    * object { polynomial  x - y + z - 1 }
  98.    * object { polynomial  x - y - z - 1 }
  99.    * object { polynomial -x + y - z - 1 }
  100.    * object { polynomial -x + y - z - 1 }
  101.    * object { polynomial -x - y - z - 1 }
  102.    * object { polynomial -x - y - z - 1 }
  103.    * object { polynomial  itau * y + tau * z - 1 }
  104.    * object { polynomial  itau * y - tau * z - 1 }
  105.    * object { polynomial -itau * y + tau * z - 1 }
  106.    * object { polynomial -itau * y - tau * z - 1 }
  107.    * object { polynomial  itau * z + tau * x - 1 }
  108.    * object { polynomial  itau * z - tau * x - 1 }
  109.    * object { polynomial -itau * z + tau * x - 1 }
  110.    * object { polynomial -itau * z - tau * x - 1 }
  111.    * object { polynomial  itau * x + tau * y - 1 }
  112.    * object { polynomial  itau * x - tau * y - 1 }
  113.    * object { polynomial -itau * x + tau * y - 1 }
  114.    * object { polynomial -itau * x - tau * y - 1 }
  115.    bounds object { sphere <0, 0, 0>, 0.72654 }
  116.    scale <1/0.72654, 1/0.72654, 1/0.72654>
  117.    }
  118.  
  119. // Simplest compound figure, two tetrahedrons
  120. define stella_octangula
  121. object {
  122.     tetrahedron
  123.   + tetrahedron { rotate <180, 90, 0> }
  124.   }
  125.  
  126. // Compound figure made out of cube and octahedron
  127. define compound_cubocta
  128. object {
  129.    cube + octahedron { scale <1.1547, 1.1547, 1.1547> }
  130.    }
  131.  
  132. // Compound figure made out of dodecahedron and icosahedron
  133. define compound_dodecicos
  134. object {
  135.    dodecahedron + icosahedron { scale <1.0982, 1.0982, 1.0982> }
  136.    }
  137.  
  138. // The two quasi-regular polytopes
  139. define cuboctahedron
  140. object {
  141.    cube * octahedron { scale <1.1547, 1.1547, 1.1547> }
  142.    }
  143.  
  144. define icosidodecahedron
  145. object {
  146.    dodecahedron * icosahedron { scale <1.0982, 1.0982, 1.0982> }
  147.    }
  148.  
  149. // Place the various polytopes in a circles around
  150. // a sphere
  151. define red_tex matte_red
  152. define green_tex matte_green
  153.  
  154. tetrahedron {
  155.    rotate <15, 15, 0>
  156.    translate <2, 0, 2>
  157.    red_tex
  158.    }
  159. cube {
  160.    rotate <15, 15, 0>
  161.    translate <2*cos(radians(72)),   2*sin(radians(72)), 2>
  162.    red_tex
  163.    }
  164. octahedron {
  165.    rotate <15, 15, 0>
  166.    translate <2*cos(radians(144)),  2*sin(radians(144)), 2>
  167.    red_tex
  168.    }
  169. dodecahedron {
  170.    rotate <15, 15, 0>
  171.    translate <2*cos(radians(-144)), 2*sin(radians(-144)), 2>
  172.    red_tex
  173.    }
  174. icosahedron {
  175.    rotate <15, 15, 0>
  176.    translate <2*cos(radians(-72)),  2*sin(radians(-72)), 2>
  177.    red_tex
  178.    }
  179.  
  180. stella_octangula {
  181.    rotate <15, 15, 0>
  182.    translate <3*cos(radians(36)),   3*sin(radians(36)), 0>
  183.    green_tex
  184.    }
  185. compound_cubocta {
  186.    rotate <15, 15, 0>
  187.    translate <3*cos(radians(108)),  3*sin(radians(108)), 0>
  188.    green_tex
  189.    }
  190. compound_dodecicos {
  191.    rotate <15, 15, 0>
  192.    translate <3*cos(radians(180)),  3*sin(radians(180)), 0>
  193.    green_tex
  194.    }
  195. cuboctahedron {
  196.    rotate <15, 15, 0>
  197.    translate <3*cos(radians(-108)), 3*sin(radians(-108)), 0>
  198.    green_tex
  199.    }
  200. icosidodecahedron {
  201.    rotate <15, 15, 0>
  202.    translate <3*cos(radians(-36)),  3*sin(radians(-36)), 0>
  203.    green_tex
  204.    }
  205.